#ifndef SKSCENE_H
#define SKSCENE_H

#include <QGraphicsScene>
#include <QList>
#include <QGraphicsWidget>
#include "../SketchModelWrapper.h"
class QKeyEvent;
class QGraphicsSceneMouseEvent;
class SkLine;
class SkPoint;
class SkSegment;
class SkCircle;

class SkScene : public QGraphicsScene
{
    Q_OBJECT

    enum SkState {
        skNormal,skDrawLine,skDrawCircle,skDrawSegment,skSelectPointsForConstraint
    } curState;

    QList<QPointF> clickedPoints;
    QGraphicsWidget *skParent; //rodzic dla wszystkich elementow
    SketchModelWrapper* model;
public:
    SkScene(QObject * parent = 0);

    void setSketchModel(SketchModelWrapper* mod);
    void addSkPoint(SkPoint* point);
    void addSkLine(SkLine* line);
    void addSkSegment(SkSegment* segment);
    void addSkCircle(SkCircle* cir);

    QGraphicsWidget* getSkParent();

public slots:
    void drawLine();
    void drawCircle();
    void drawSegment();
    void setNormal();
    void clearScene();
    void pointPosChanged(int i, QPointF newPos);
    void pointClicked(int i);
signals:
    void pointPosHasChanged(int,QPointF);
    void pointHasClicked(int i);

protected:
    void mousePressEvent ( QGraphicsSceneMouseEvent * mouseEvent );
};

#endif // SKSCENE_H
